<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    {:token()}
    <input type="hidden" name="row[id]" value="{$row.id}">
    <input type="hidden" name="row[loginaccount]" id="c-loginaccount" value="{$row.loginaccount}">
    <input type="hidden" name="row[businesspersonnel]" id="c-businesspersonnel" value="{$row.businesspersonnel}">
    <input type="hidden" name="row[ordernumber]" id="c-ordernumber" value="{$row.ordernumber}">
    <div class="form-group">
        <label for="c-loginaccount" class="control-label col-xs-12 col-sm-2">{:__('Loginaccount')}:</label>
        <div class="col-xs-12 col-sm-4">
            <select name="row[userid]" id="c-userid" class="form-control selectpicker" data-rule="required"
                onchange="changeusername()">
                {foreach name='$userList' item="user"}
                <option value="{$user['id']}" {if $user.id==$row.userid}selected{/if}>{$user['username']}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="c-documenttype" class="control-label col-xs-12 col-sm-2">{:__('Documenttype')}:</label>
        <div class="col-xs-12 col-sm-4">
            {$typeList}
        </div>
    </div>
    <div class="form-group">
        <label for="c-identificationnumber"
            class="control-label col-xs-12 col-sm-2">{:__('Identificationnumber')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-identificationnumber" data-rule="required" class="form-control"
                name="row[identificationnumber]" type="text" value="{$row.identificationnumber|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-reservationpassword"
            class="control-label col-xs-12 col-sm-2">{:__('Reservationpassword')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-reservationpassword" data-rule="required" class="form-control" name="row[reservationpassword]"
                type="text" value="{$row.reservationpassword}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-orderamount" class="control-label col-xs-12 col-sm-2">{:__('Orderamount')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-orderamount" data-rule="required" class="form-control" name="row[orderamount]" type="number"
                value="{$row.orderamount}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-ispay" class="control-label col-xs-12 col-sm-2">{:__('Ispay')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[ispay]', ['1'=>__('Yes'), '0'=>__('No')], $row['ispay'])}
        </div>
    </div>
    <div class="form-group">
        <label for="c-isstartappointment" class="control-label col-xs-12 col-sm-2">{:__('Isstartappointment')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[isstartappointment]', ['0'=>__('未开始'), '1'=>__('已开始'), '2'=>__('已结束')],
            $row['isstartappointment'])}
        </div>
    </div>
    <div class="form-group">
        <label for="c-businesspersonnel" class="control-label col-xs-12 col-sm-2">{:__('businesspersonnel')}:</label>
        <div class="col-xs-12 col-sm-4">
            <select name="row[businessid]" id="c-businessid" class="form-control selectpicker" data-rule="required"
                onchange="changebusinesspersonnel()">
                {foreach name='$businessList' item="business"}
                <option value="{$business['id']}" {if $business.id==$row.businessid}selected{/if}>{$business['name']}
                </option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script>
    //选中登录账户
    function changeusername() {
        var myselect = document.getElementById("c-userid");
        var index = myselect.selectedIndex;
        var loginaccount = document.getElementById('c-loginaccount');
        loginaccount.value = myselect.options[index].text
    }

    //选择业务人员
    function changebusinesspersonnel() {
        var myselect = document.getElementById("c-businessid");
        var index = myselect.selectedIndex;
        var businesspersonnel = document.getElementById('c-businesspersonnel');
        businesspersonnel.value = myselect.options[index].text
    }
    changeusername();
    changebusinesspersonnel();
</script>